package com.demo.study.behavior.d01_chainOfResponsibility.serverlet.filter;

import com.demo.study.behavior.d01_chainOfResponsibility.serverlet.Filter;
import com.demo.study.behavior.d01_chainOfResponsibility.serverlet.FilterChain;
import com.demo.study.behavior.d01_chainOfResponsibility.serverlet.Request;
import com.demo.study.behavior.d01_chainOfResponsibility.serverlet.Response;

/**
 * @author Baymax
 * @since 2021/1/17
 */
public class PlaceFilter implements Filter {
    @Override
    public boolean doFilter(Request request, Response response, FilterChain filterChain) {
        request.setMsg(request.getMsg().replace("<place>", request.getPlace()) + "--PlaceFilter--");
        filterChain.doFilter(request, response, filterChain);
        response.setMsg(response.getMsg().replace("<place>", response.getPlace()) + "--PlaceFilter--");
        return true;
    }
}
